#include <unistd.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>


int main() {
	int sock;
	struct sockaddr_in addr;
	if((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0)
	{
		perror("socket");
		exit(errno);
	}
	
	bzero(&addr, sizeof(addr));
	addr.sin_family = AF_INET;
	addr.sin_port = htons(3425);
	addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);

	if(connect(sock, (struct sockaddr *)&addr, sizeof(addr)) < 0)
	{
		perror("connect");
		exit(errno);
	}

	char message[] = "Hello, server";
	char buf[sizeof(message)];

	send(sock, message, sizeof(message), 0);
	recv(sock, buf, sizeof(message), 0);
	printf("%s\n", buf);
	close(sock);

	return 0;
}

